Row echelon form

In linear algebra a matrix is in row echelon form if

This is an example of 3x4 matrix in row echelon form:


\left[ \begin{array}{ccc|c}
1 & a_1 & a_2 & a_3 \\
0 & 1 & a_4 & a_5 \\
0 & 0 & 1 & a_6
\end{array} \right]

A matrix is in reduced row echelon form (also called row canonical form) if it satisfies the additional condition:


\left[ \begin{array}{ccc|c}
1 & 0 & 0 & b_1 \\
0 & 1 & 0 & b_2 \\
0 & 0 & 1 & b_3
\end{array} \right]

Note that this does not always mean that the left of the matrix will be an identity matrix. For example, the following matrix is also in reduced row-echelon form:


\left[ \begin{array}{cccc|c}
1 & 0 & 1/2  & 0 & b_1 \\
0 & 1 & -1/3 & 0 & b_2 \\
0 & 0 & 0    & 1 & b_3
\end{array} \right]

because the constants in the third column do not lead any rows.

Contents

Transformation to row echelon form

By means of a finite sequence of elementary row operations, any matrix can be transformed to row echelon form. Since elementary row operations preserve the row space of the matrix, the row space of the row echelon form is the same as that of the original matrix.

The resulting echelon form is not unique; for example, any multiple of a matrix in echelon form is also in echelon form. However, it has been proven that any matrix can be transformed to exactly one matrix in reduced row echelon form. This means that the nonzero rows of the reduced row echelon form are the unique reduced row echelon generating set for the row space of the original matrix.

Systems of linear equations

A system of linear equations is said to be in row echelon form if its augmented matrix is in row echelon form. Similarly, a system of equations is said to be in reduced row echelon form or canonical form if its augmented matrix is in reduced row echelon form.

Pseudocode

The following pseudocode converts a matrix to (non-reduced) row-echelon form:

function ToRowEchelonForm(Matrix M) is
    nr := number of rows in M
    nc := number of columns in M
    
    for 0 ≤ r < nr do
        allZeros := true
        for 0 ≤ c < nc do
            if M[r, c] != 0 then
                allZeros := false
                exit for
            end if
        end for
        if allZeros = true then
            In M, swap row r with row nr - 1
            nr := nr - 1
        end if
    end for
    
    p := 0
    while p < nr and p < nc do
        label nextPivot:
            r := 1
            while M[p, p] = 0 do 
                if (p + r) <= nr then
                    p := p + 1
                    goto nextPivot
                end if
                In M, swap row p with row (p + r) <-- bug. nr < p+r at this point
                r := r + 1
            end while
            for 1 ≤ r < (nr - p) do 
                if M[p + r, p] != 0 then
                    x := -M[p + r, p] / M[p, p]
                    for pc < nc do
                        M[p + r, c] := M[p , c] * x + M[p + r, c]
                    end for
                end if
            end for
            p := p + 1
    end while
end function

See also

External links